/***************************************************************************//**
 * @file CGI/CamManipulatorInternal.cpp
 * @author  Marek M. Cel <marekcel@mscsim.org>
 *
 * @section LICENSE
 *
 * Copyright (C) 2013 Marek M. Cel
 *
 * This file is part of MScSim. You can redistribute and modify it under
 * the terms of GNU General Public License as published by the Free Software
 * Foundation; either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Further information about the GNU General Public License can also be found
 * on the world wide web at http://www.gnu.org.
 ******************************************************************************/
#ifndef CAM_MANIPULATOR_INTERNAL_CPP
#define CAM_MANIPULATOR_INTERNAL_CPP
#endif

////////////////////////////////////////////////////////////////////////////////

#include <CGI/CamManipulatorInternal.h>

////////////////////////////////////////////////////////////////////////////////

CamManipulatorInternal::CamManipulatorInternal() :
    inherited()
{}

////////////////////////////////////////////////////////////////////////////////

CamManipulatorInternal::CamManipulatorInternal( const CamManipulatorInternal &cmi,
                                                        const osg::CopyOp &copyOp ) :
    osg::Object( cmi, copyOp ),
    inherited( cmi, copyOp ),
    m_matrix( cmi.m_matrix )
{}

////////////////////////////////////////////////////////////////////////////////

void CamManipulatorInternal::setByMatrix( const osg::Matrixd &matrix )
{
    m_matrix = matrix;
}

////////////////////////////////////////////////////////////////////////////////

void CamManipulatorInternal::setByInverseMatrix( const osg::Matrixd &matrix )
{
    setByMatrix( osg::Matrixd::inverse( matrix ) );
}

////////////////////////////////////////////////////////////////////////////////

osg::Matrixd CamManipulatorInternal::getMatrix() const
{
    return m_matrix;
}

////////////////////////////////////////////////////////////////////////////////

osg::Matrixd CamManipulatorInternal::getInverseMatrix() const
{
    return osg::Matrixd::inverse( m_matrix );
}

////////////////////////////////////////////////////////////////////////////////

bool CamManipulatorInternal::handle( const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &/*us*/ )
{
    switch ( ea.getEventType() )
    {
    case osgGA::GUIEventAdapter::FRAME:
        updateMatrix();
        return false;
        break;
    default:
        break;
    }

    return false;
}

////////////////////////////////////////////////////////////////////////////////

void CamManipulatorInternal::updateMatrix()
{

}
